﻿using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using nplJobsCommon.Employeer;

namespace nplJobsDAL.Update
{
    public class UpdateEmployeer : DataAccessBase
    {
        public Employeer Employeer { get; set; }
        public UpdateEmployeer()
        {
            StoredProcedureName = StoredProcedure.Name.spUpdateEmployeer.ToString();
        }
        public void invoke()
        {
            EmployeerUpdateDataParameters contactUpdateDataParameters = new EmployeerUpdateDataParameters(this.Employeer);
            DataBaseHelper dbHelper = new DataBaseHelper(StoredProcedureName);
            dbHelper.Parameters = contactUpdateDataParameters.Parameters;
            dbHelper.RunScalar();
        }
    }

    #region SQL parameters for  employeer contact person insert data
    public class EmployeerUpdateDataParameters
    {
        private Employeer _employeer;

        public EmployeerUpdateDataParameters(Employeer employeer)
        {
            this._employeer = employeer;
            Build();
        }

        private void Build()
        {
            SqlParameter[] parameters = 
                {
                    new SqlParameter("@EmployeerID", _employeer.EmployeerID),
                    new SqlParameter("@Password", _employeer.Password),
                    new SqlParameter("@CompanyImage", _employeer.EmployeerImagePath)
                };

            Parameters = parameters;
        }

        public SqlParameter[] Parameters { get; set; }
    }
    #endregion
}
